Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add ApiEnum and apiEnumValueOfOrNull helper methods #283

Merged
merged 1 commit into from
Feb 14, 2025

Conversation

LunarX
Copy link
Collaborator

@LunarX LunarX commented Feb 13, 2025

Now that we write enums with PascalCase we can't always use the enumValueOfOrNull and base the recognition on the name of the enum value. So I added a helper method to easily get an enum instance for any enum that extends the ApiEnum interface. The interface only requires the children to implement an apiValue field that will be used to match the input string. The helper method is pretty similar to the existing enumValueOfOrNull but with a different name.

Downgrading androidxCore was necessary to use the module on Mail for the time being.

Now that we write enums with PascalCase we can't always use the `enumValueOfOrNull` and base the recognition on the name of the enum value. So I added a helper method to easily get an enum instance for any enum that extends the ApiEnum interface. The interface only requires the children to implement an `apiValue` field that will be used to match the input string. The helper method is pretty similar to the existing `enumValueOfOrNull` but with a different name.

Downgrading androidxCore was necessary to use the module on Mail for the time being.
@LunarX LunarX requested a review from a team February 13, 2025 15:45
@LunarX LunarX self-assigned this Feb 13, 2025
@LunarX LunarX merged commit 7849dd7 into main Feb 14, 2025
7 checks passed
@LunarX LunarX deleted the api-enum-helper branch February 14, 2025 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants